def bubbleSort(arr):
    n = len(arr)
    for i in range(n):
        swapped = False
        for j in range(0, n-i-1):
            if arr[j] > arr[j+1] :
                arr[j], arr[j+1] = arr[j+1], arr[j]
                swapped = True
        if swapped == False:
            break
    return arr

def bubbleSort2(arr):
    n = len(arr)
    for i in range(n - 1):
        for j in range(i + 1, n):
            if arr[i] > arr[j]:
                arr[i], arr[j] = arr[j], arr[i]
    return arr

if __name__ == '__main__':
    arr = [64, 34, 25, 12, 22, 11, 90]
    print("Original array is:")
    for i in range(len(arr)):
        print(arr[i], end=" ")
    print()
    # arr = bubbleSort(arr)
    arr = bubbleSort2(arr)
    print("Sorted array is:")
    for i in range(len(arr)):
        print(arr[i], end=" ")